package com.xli.mis.tablecategory.entity.mapper;

import com.xli.mis.tablecategory.entity.TableCategory;
import com.xli.mis.tablecategory.entity.dto.TableCategoryAddDTO;
import com.xli.mis.tablecategory.entity.dto.TableCategoryUpdateDTO;
import com.xli.mis.tablecategory.entity.vo.TableCategoryVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;


@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ITableCategoryMapper {

    ITableCategoryMapper INSTANCE = Mappers.getMapper(ITableCategoryMapper.class);

    @Mappings({
            @Mapping(source = "categoryName", target = "category_name"),
            @Mapping(source = "orderNum", target = "order_num")
    })
    TableCategory toEntity(TableCategoryAddDTO tableCategoryAddDTO);

    @Mappings({
            @Mapping(source = "categoryName", target = "category_name"),
            @Mapping(source = "orderNum", target = "order_num")
    })
    TableCategory toEntity(TableCategoryUpdateDTO tableCategoryUpdateDTO);

    @Mappings({
            @Mapping(source = "category_name", target = "categoryName"),
            @Mapping(source = "order_num", target = "orderNum")
    })
    TableCategoryVO toVO(TableCategory tableCategory);
}
